package com.nanyang.tms.common.dict;

import com.nanyang.tms.common.exception.TmsManagerException;

/**
 * <p>OrderState</p>
 * <p>Description:订单状态</p>
 */
public enum TmsOrderStateEnum {
    /**
     * 订单支付状态
     */
    PAY_ING(0, "支付处理中"),
    PAY_SUCCESS(2, "支付成功"),
    PAY_FAIL(3, "支付失败"),
    ;

    private Integer code;
    private String desc;

    TmsOrderStateEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static TmsOrderStateEnum of(Integer orderState) {
        for (TmsOrderStateEnum temp : TmsOrderStateEnum.values()) {
            if (temp.getCode().equals(orderState)) {
                return temp;
            }
        }
        throw new TmsManagerException(TmsExceptionEnum.ENUM_VALUE_NOT_FOUND.getCode(),TmsExceptionEnum.ENUM_VALUE_NOT_FOUND.getMessage());
    }

}